<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="edu.gatech.team404.Lab"%>
<%@page import="edu.gatech.team404.Account"%>
<%@page import="edu.gatech.team404.dal.LabDAL"%>
<%@page import="edu.gatech.team404.dal.AccountDAL"%>

<%@include file="header.jsp" %>

<div id="content">
    <%@include file="sidebar.jsp" %>
    
    <div id="main">
    	<%
    		final String courseName = request.getParameter("course");
    		final CourseDAL cDal = new CourseDAL();
    		final Course crs = cDal.getCourseByName(courseName);
    		
    		final AccountDAL aDal = new AccountDAL();
    		Account instructor = aDal.getAccount(crs.getInstructor());
    		
    		cDal.close();
    		aDal.close();
    	%>
    	<h1 align="center"><%= crs.getName() %></h1>
    	<table class="viewTable" border="1" cellpadding="10">
    		<tr>
    			<th>Instructor</th>
    			<td><%= instructor.getName() %></td>
    		</tr>
    		<tr>
    			<th>Description</th>
    			<td><%= crs.getDescription() %></td>
    		</tr>
    		<tr>
    			<th>Labs</th>
    			<td>
    				<%	
    					LabDAL ldal = new LabDAL();
    					List<Lab> labs = ldal.getAllLabsInCourse(courseName);
    					ldal.close();
    					
    					for (Lab lab : labs) {
    						out.print(lab.getName() + "<br/>");
    					}
    				%>
    			</td>
    		</tr>
    	</table>
    </div>
</div>

<%@include file="footer.jsp" %>